MATLAB For Dummies by John Paul Mueller & Jim Sizemore

MATLAB For Dummies by John Paul Mueller & Jim Sizemore

Author:John Paul Mueller & Jim Sizemore [Mueller, John Paul & Sizemore, Jim]
Language: eng
Format: epub
ISBN: 9781119796909
Publisher: Wiley
Published: 2021-06-07T00:00:00+00:00


Starting a new loop iteration using continue

There are times when you won’t want to perform any processing should certain events occur, such as a value you don’t really need. However, you don’t want to stop the processing as a whole — you only want to stop this particular iteration of the loop. The continue clause makes it possible to end the current iteration and move on to the next loop iteration.

Listing 10-4 shows how to use the continue clause with a while loop, but you can use it precisely the same way with the for loop. The examples in the “Making Decisions” section, earlier in the chapter, provide steps for creating functions. You can also find this function in the UsingContinue.m file supplied with the downloadable source code.

LISTING 10-4 Using the continue clause

function [ ] = UsingContinue( Times )

%UsingContinue: Demonstrates the while loop

% Tell the application which iterations to process.

% Iteration five displays a special message.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.